Trait anoma_apps::std::prelude::rust_2018::From1.0.0[][src]

pub trait From<T> {
    fn from(T) -> Self;
}
Expand description

Used to do value-to-value conversions while consuming the input value. It is the reciprocal of Into.

One should always prefer implementing From over Into because implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Only implement Into when targeting a version prior to Rust 1.41 and converting to a type outside the current crate. From was not able to do these types of conversions in earlier versions because of Rust’s orphaning rules. See Into for more details.

Prefer using Into over using From when specifying trait bounds on a generic function. This way, types that directly implement Into can be used as arguments as well.

The From is also very useful when performing error handling. When constructing a function that is capable of failing, the return type will generally be of the form Result<T, E>. The From trait simplifies error handling by allowing a function to return a single error type that encapsulate multiple error types. See the “Examples” section and the book for more details.

Note: This trait must not fail. If the conversion can fail, use TryFrom.

Generic Implementations

  • From<T> for U implies Into<U> for T
  • From is reflexive, which means that From<T> for T is implemented

Examples

String implements From<&str>:

An explicit conversion from a &str to a String is done as follows:

let string = "hello".to_string();
let other_string = String::from("hello");

assert_eq!(string, other_string);

While performing error handling it is often useful to implement From for your own error type. By converting underlying error types to our own custom error type that encapsulates the underlying error type, we can return a single error type without losing information on the underlying cause. The ‘?’ operator automatically converts the underlying error type to our custom error type by calling Into<CliError>::into which is automatically provided when implementing From. The compiler then infers which implementation of Into should be used.

use std::fs;
use std::io;
use std::num;

enum CliError {
    IoError(io::Error),
    ParseError(num::ParseIntError),
}

impl From<io::Error> for CliError {
    fn from(error: io::Error) -> Self {
        CliError::IoError(error)
    }
}

impl From<num::ParseIntError> for CliError {
    fn from(error: num::ParseIntError) -> Self {
        CliError::ParseError(error)
    }
}

fn open_and_parse_file(file_name: &str) -> Result<i32, CliError> {
    let mut contents = fs::read_to_string(&file_name)?;
    let num: i32 = contents.trim().parse()?;
    Ok(num)
}

Required methods

Performs the conversion.

Implementations on Foreign Types

Converts an Ipv4Addr into a host byte order u32.

Examples
use std::net::Ipv4Addr;

let addr = Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe);
assert_eq!(0xcafebabe, u32::from(addr));

Convert an Ipv6Addr into a host byte order u128.

Examples
use std::net::Ipv6Addr;

let addr = Ipv6Addr::new(
    0x1020, 0x3040, 0x5060, 0x7080,
    0x90A0, 0xB0C0, 0xD0E0, 0xF00D,
);
assert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128, u128::from(addr));

Converts i8 to i64 losslessly.

Converts a NonZeroUsize into an usize

Converts a bool to a i16. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(i16::from(true), 1);
assert_eq!(i16::from(false), 0);

Converts a char into a u128.

Examples
use std::mem;

let c = '⚙';
let u = u128::from(c);
assert!(16 == mem::size_of_val(&u))

Converts a bool to a i8. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(i8::from(true), 1);
assert_eq!(i8::from(false), 0);

Converts u8 to i16 losslessly.

Converts u16 to f64 losslessly.

Converts i8 to f64 losslessly.

Converts u32 to i128 losslessly.

Converts a bool to a i128. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(i128::from(true), 1);
assert_eq!(i128::from(false), 0);

Converts u16 to f32 losslessly.

Converts a NonZeroIsize into an isize

Converts a NonZeroU16 into an u16

Converts a NonZeroI8 into an i8

Converts u8 to i32 losslessly.

Converts a bool to a i64. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(i64::from(true), 1);
assert_eq!(i64::from(false), 0);

Converts i32 to f64 losslessly.

Converts u8 to isize losslessly.

Converts a NonZeroU64 into an u64

Converts f32 to f64 losslessly.

Converts i64 to i128 losslessly.

Converts i8 to isize losslessly.

Converts i16 to i32 losslessly.

Converts i16 to i64 losslessly.

Converts u64 to u128 losslessly.

Converts i16 to f32 losslessly.

Converts a NonZeroI64 into an i64

Converts a NonZeroU128 into an u128

Converts u16 to u128 losslessly.

Converts a bool to a usize. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(usize::from(true), 1);
assert_eq!(usize::from(false), 0);

Converts a char into a u32.

Examples
use std::mem;

let c = 'c';
let u = u32::from(c);
assert!(4 == mem::size_of_val(&u))

Converts u32 to u128 losslessly.

Converts u32 to i64 losslessly.

Converts i16 to i128 losslessly.

Converts a bool to a isize. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(isize::from(true), 1);
assert_eq!(isize::from(false), 0);

Converts u16 to u64 losslessly.

Converts a bool to a u32. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(u32::from(true), 1);
assert_eq!(u32::from(false), 0);

Converts i8 to i32 losslessly.

Converts u8 to usize losslessly.

Converts u8 to u32 losslessly.

Converts a bool to a u128. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(u128::from(true), 1);
assert_eq!(u128::from(false), 0);

Converts a NonZeroI32 into an i32

Converts i32 to i128 losslessly.

Converts u8 to u64 losslessly.

Converts a NonZeroU32 into an u32

Converts u16 to i64 losslessly.

Converts u16 to usize losslessly.

Maps a byte in 0x00..=0xFF to a char whose code point has the same value, in U+0000..=U+00FF.

Unicode is designed such that this effectively decodes bytes with the character encoding that IANA calls ISO-8859-1. This encoding is compatible with ASCII.

Note that this is different from ISO/IEC 8859-1 a.k.a. ISO 8859-1 (with one less hyphen), which leaves some “blanks”, byte values that are not assigned to any character. ISO-8859-1 (the IANA one) assigns them to the C0 and C1 control codes.

Note that this is also different from Windows-1252 a.k.a. code page 1252, which is a superset ISO/IEC 8859-1 that assigns some (not all!) blanks to punctuation and various Latin characters.

To confuse things further, on the Web ascii, iso-8859-1, and windows-1252 are all aliases for a superset of Windows-1252 that fills the remaining blanks with corresponding C0 and C1 control codes.

Converts a u8 into a char.

Examples
use std::mem;

let u = 32 as u8;
let c = char::from(u);
assert!(4 == mem::size_of_val(&c))

Converts a NonZeroI128 into an i128

Converts u64 to i128 losslessly.

Converts u8 to i128 losslessly.

Converts a bool to a i32. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(i32::from(true), 1);
assert_eq!(i32::from(false), 0);

Converts i16 to f64 losslessly.

Converts i32 to i64 losslessly.

Converts i8 to f32 losslessly.

Converts u8 to u128 losslessly.

Converts a bool to a u64. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(u64::from(true), 1);
assert_eq!(u64::from(false), 0);

Converts u16 to i32 losslessly.

Converts i8 to i16 losslessly.

Converts u8 to f32 losslessly.

Converts a NonZeroU8 into an u8

Converts u32 to f64 losslessly.

Converts u8 to u16 losslessly.

Converts i16 to isize losslessly.

Converts a bool to a u16. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(u16::from(true), 1);
assert_eq!(u16::from(false), 0);

Converts a bool to a u8. The resulting value is 0 for false and 1 for true values.

Examples
assert_eq!(u8::from(true), 1);
assert_eq!(u8::from(false), 0);

Converts i8 to i128 losslessly.

Converts u8 to i64 losslessly.

Converts u8 to f64 losslessly.

Converts a char into a u64.

Examples
use std::mem;

let c = '👤';
let u = u64::from(c);
assert!(8 == mem::size_of_val(&u))

Converts u16 to i128 losslessly.

Converts u16 to u32 losslessly.

Converts u32 to u64 losslessly.

Converts a NonZeroI16 into an i16

Get back the gas limit as a raw number

Warning: f64 loses precision and it should not be used when exact values are required.

Get back the gas limit as a raw number

Get back the gas limit as a raw number, viewed as an Amount

Round the input number up to the next highest multiple of GAS_LIMIT_RESOLUTION

Round the input number up to the next highest multiple of GAS_LIMIT_RESOLUTION

Warning: f64 loses precision and it should not be used when exact values are required.

Conversion from Tendermint domain type into IBC domain type.

Convert a DateTime<Utc> instance into a DateTime<FixedOffset> instance.

Convert this DateTime<Utc> instance into a DateTime<FixedOffset> instance.

Conversion is done via DateTime::with_timezone. Note that the converted value returned by this will be created with a fixed timezone offset of 0.

Convert a DateTime<Local> instance into a DateTime<FixedOffset> instance.

Convert this DateTime<Local> instance into a DateTime<FixedOffset> instance.

Conversion is performed via DateTime::with_timezone. Note that the converted value returned by this will be created with a fixed timezone offset of 0.

Convert a DateTime<Utc> instance into a DateTime<Local> instance.

Convert this DateTime<Utc> instance into a DateTime<Local> instance.

Conversion is performed via DateTime::with_timezone, accounting for the difference in timezones.

Convert a DateTime<Local> instance into a DateTime<Utc> instance.

Convert this DateTime<Local> instance into a DateTime<Utc> instance.

Conversion is performed via DateTime::with_timezone, accounting for the difference in timezones.

Convert a DateTime<FixedOffset> instance into a DateTime<Utc> instance.

Convert this DateTime<FixedOffset> instance into a DateTime<Utc> instance.

Conversion is performed via DateTime::with_timezone, accounting for the timezone difference.

Convert a DateTime<FixedOffset> instance into a DateTime<Local> instance.

Convert this DateTime<FixedOffset> instance into a DateTime<Local> instance.

Conversion is performed via DateTime::with_timezone. Returns the equivalent value in local time.

Convert a Uri from parts

Examples

Relative URI

let mut parts = Parts::default();
parts.path_and_query = Some("/foo".parse().unwrap());

let uri = Uri::from_parts(parts).unwrap();

assert_eq!(uri.path(), "/foo");

assert!(uri.scheme().is_none());
assert!(uri.authority().is_none());

Absolute URI

let mut parts = Parts::default();
parts.scheme = Some("http".parse().unwrap());
parts.authority = Some("foo.com".parse().unwrap());
parts.path_and_query = Some("/foo".parse().unwrap());

let uri = Uri::from_parts(parts).unwrap();

assert_eq!(uri.scheme().unwrap().as_str(), "http");
assert_eq!(uri.authority().unwrap(), "foo.com");
assert_eq!(uri.path(), "/foo");

Notes

The underlying pipe is not set to non-blocking.

Notes

The underlying pipe is not set to non-blocking.

Notes

The underlying pipe is not set to non-blocking.

Examples
use indexmap::IndexMap;

let map1 = IndexMap::from([(1, 2), (3, 4)]);
let map2: IndexMap<_, _> = [(1, 2), (3, 4)].into();
assert_eq!(map1, map2);
Examples
use indexmap::IndexSet;

let set1 = IndexSet::from([1, 2, 3, 4]);
let set2: IndexSet<_> = [1, 2, 3, 4].into();
assert_eq!(set1, set2);

Optional

This function requires enabling the stream feature in your Cargo.toml.

On Windows, a corresponding From<&impl AsRawSocket> implementation exists.

The caller must ensure S is actually a socket.

Converts a std::time::Duration to a Duration.

Info -> SimpleValidator

Convert the Choice wrapper into a bool, depending on whether the underlying u8 was a 0 or a 1.

Note

This function exists to avoid having higher-level cryptographic protocol implementations duplicating this pattern.

The intended use case for this conversion is at the end of a higher-level primitive implementation: for example, in checking a keyed MAC, where the verification should happen in constant-time (and thus use a Choice) but it is safe to return a bool at the end of the verification.

Converts mutable slice to a mutable generic array reference

Length of the slice must be equal to the length of the array.

Converts slice to a generic array reference with inferred length;

Length of the slice must be equal to the length of the array.

Construct an ExpandedSecretKey from a SecretKey.

Examples
use rand::rngs::OsRng;
use ed25519_dalek::{SecretKey, ExpandedSecretKey};

let mut csprng = OsRng{};
let secret_key: SecretKey = SecretKey::generate(&mut csprng);
let expanded_secret_key: ExpandedSecretKey = ExpandedSecretKey::from(&secret_key);

Derive this public key from its corresponding SecretKey.

Derive this public key from its corresponding ExpandedSecretKey.

DEPRECATED: use TryFrom<&[u8]> instead.

Warning

This conversion will panic if a signature is invalid.

Construct a scalar from the given u64.

Inputs

An u64 to convert to a Scalar.

Returns

A Scalar corresponding to the input u64.

Example
use curve25519_dalek::scalar::Scalar;

let fourtytwo = Scalar::from(42u64);
let six = Scalar::from(6u64);
let seven = Scalar::from(7u64);

assert!(fourtytwo == six * seven);

Convert map (with string keys) to Value

Examples
use serde_json::{Map, Value};

let mut m = Map::new();
m.insert("Lorem".to_string(), "ipsum".into());
let x: Value = m.into();

Convert a slice to Value

Examples
use serde_json::Value;

let v: &[&str] = &["lorem", "ipsum", "dolor"];
let x: Value = v.into();

Convert String to Value

Examples
use serde_json::Value;

let s: String = "lorem".to_string();
let x: Value = s.into();

Convert copy-on-write string to Value

Examples
use serde_json::Value;
use std::borrow::Cow;

let s: Cow<str> = Cow::Borrowed("lorem");
let x: Value = s.into();
use serde_json::Value;
use std::borrow::Cow;

let s: Cow<str> = Cow::Owned("lorem".to_string());
let x: Value = s.into();

Convert string slice to Value

Examples
use serde_json::Value;

let s: &str = "lorem";
let x: Value = s.into();

Convert boolean to Value

Examples
use serde_json::Value;

let b = false;
let x: Value = b.into();

Convert () to Value

Examples
use serde_json::Value;

let u = ();
let x: Value = u.into();

Convert Number to Value

Examples
use serde_json::{Number, Value};

let n = Number::from(7);
let x: Value = n.into();

Convert a Vec to Value

Examples
use serde_json::Value;

let v = vec!["lorem", "ipsum", "dolor"];
let x: Value = v.into();

Convert 32-bit floating point number to Value

Examples
use serde_json::Value;

let f: f32 = 13.37;
let x: Value = f.into();

Convert 64-bit floating point number to Value

Examples
use serde_json::Value;

let f: f64 = 13.37;
let x: Value = f.into();

Create level by number

Uses the full slice as the initial length.

Example
let mut arr = [0_i32; 2];
let mut sv = SliceVec::from(&mut arr[..]);

The output has a length equal to the full array.

If you want to select a length, use from_array_len

Calls AsRef::as_mut then uses the full slice as the initial length.

Example
let mut arr = [0, 0];
let mut sv = SliceVec::from(&mut arr);

Convert from Result to Either with Ok => Right and Err => Left.

Given (low: usize, high: usize), then a size range of [low..high) is the result.

Given low ..= high, then a size range [low, high] is the result.

Given low .. high, then a size range [low, high) is the result.

Creates a Probability from a f64.

Panics

Panics if the probability is outside interval [0.0, 1.0].

Given ..high, then a size range [0, high) is the result.

Given exact, then a size range of [exact, exact] is the result.

Given ..=high, then a size range [0, high] is the result.

Create an ArrayVec from an array.

use arrayvec::ArrayVec;

let mut array = ArrayVec::from([1, 2, 3]);
assert_eq!(array.len(), 3);
assert_eq!(array.capacity(), 3);

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Converts Self::BigInteger into Self

Panics

This method panics if int is larger than P::MODULUS.

Create an ArrayVec from an array.

use arrayvec::ArrayVec;

let mut array = ArrayVec::from([1, 2, 3]);
assert_eq!(array.len(), 3);
assert_eq!(array.capacity(), 3);

Convert t into a packed Some(x).

Convert an option into its packed equivalent.

Convenience converter for making error-reporting less verbose.

Converts a tuple of (location, context, message) to a VerifierError.

use cranelift_codegen::verifier::VerifierErrors;
use cranelift_codegen::ir::Inst;
let mut errors = VerifierErrors::new();
errors.report((Inst::from_u32(42), "v3 = iadd v1, v2", "iadd cannot be used with values of this type"));
// note the double parenthenses to use this syntax

Convenience converter for making error-reporting less verbose.

Same as above but without context.

Convert t into a packed Some(x).

Convert an option into its packed equivalent.

Returns a new atomic pointer pointing to owned.

Examples
use crossbeam_epoch::{Atomic, Owned};

let a = Atomic::<i32>::from(Owned::new(1234));

Returns a new owned pointer pointing to b.

Panics

Panics if the pointer (the Box) is not properly aligned.

Examples
use crossbeam_epoch::Owned;

let o = unsafe { Owned::from_raw(Box::into_raw(Box::new(1234))) };

Returns a new pointer pointing to raw.

Panics

Panics if raw is not properly aligned.

Examples
use crossbeam_epoch::Shared;

let p = Shared::from(Box::into_raw(Box::new(1234)) as *const _);
assert!(!p.is_null());

Returns a new atomic pointer pointing to ptr.

Examples
use crossbeam_epoch::{Atomic, Shared};

let a = Atomic::<i32>::from(Shared::<i32>::null());

Returns a new atomic pointer pointing to raw.

Examples
use std::ptr;
use crossbeam_epoch::Atomic;

let a = Atomic::<i32>::from(ptr::null::<i32>());

Promote a Secp256k1 secret key into a keypair.

Promote an Ed25519 secret key into a keypair.

Demote a Secp256k1 keypair into a secret key.

Demote an Ed25519 keypair to a secret key.

Converts slice to a generic array reference with inferred length;

Length of the slice must be equal to the length of the array.

Converts mutable slice to a mutable generic array reference

Length of the slice must be equal to the length of the array.

Convert the Choice wrapper into a bool, depending on whether the underlying u8 was a 0 or a 1.

Note

This function exists to avoid having higher-level cryptographic protocol implementations duplicating this pattern.

The intended use case for this conversion is at the end of a higher-level primitive implementation: for example, in checking a keyed MAC, where the verification should happen in constant-time (and thus use a Choice) but it is safe to return a bool at the end of the verification.

used for ordering purposes. The highest priority is placed on open connections

Convert from DNSClass to u16

use trust_dns_proto::rr::dns_class::DNSClass;

let var: u16 = DNSClass::IN.into();
assert_eq!(1, var);

only the supported extensions are listed right now.

This returns a Resource Record that is formatted for Edns(0). Note: the rcode_high value is only part of the rcode, the rest is part of the base

Convert from RecordType to u16

use std::convert::From;
use trust_dns_proto::rr::record_type::RecordType;

let var: u16 = RecordType::A.into();
assert_eq!(1, var);

Convert from DNSClass to &str

use trust_dns_proto::rr::dns_class::DNSClass;

let var: &'static str = DNSClass::IN.into();
assert_eq!("IN", var);

Convert from RecordType to &str

use std::convert::From;
use trust_dns_proto::rr::record_type::RecordType;

let var: &'static str = From::from(RecordType::A);
assert_eq!("A", var);

let var: &'static str = RecordType::A.into();
assert_eq!("A", var);

Convert from u16 to RecordType

use trust_dns_proto::rr::record_type::RecordType;

let var = RecordType::from(1);
assert_eq!(RecordType::A, var);

Convert from OpCode to u8

use std::convert::From;
use trust_dns_proto::op::op_code::OpCode;

let var: u8 = From::from(OpCode::Query);
assert_eq!(0, var);

let var: u8 = OpCode::Query.into();
assert_eq!(0, var);

Convert from ResponseCode to u16

use std::convert::From;
use trust_dns_proto::op::response_code::ResponseCode;

let var: ResponseCode = From::from(0);
assert_eq!(ResponseCode::NoError, var);

let var: ResponseCode = 0.into();
assert_eq!(ResponseCode::NoError, var);

Convert from u16 to ResponseCode

use std::convert::From;
use trust_dns_proto::op::response_code::ResponseCode;

let var: u16 = From::from(ResponseCode::NoError);
assert_eq!(0, var);

let var: u16 = ResponseCode::NoError.into();
assert_eq!(0, var);

Converts a std::os::unix::net::UnixListener into its asynchronous equivalent.

Converts a std::net::TcpListener into its asynchronous equivalent.

Converts a std::os::unix::net::UnixDatagram into its asynchronous equivalent.

Converts a std::net::TcpStream into its asynchronous equivalent.

Converts a std::net::UdpSocket into its asynchronous equivalent.

Converts a std::os::unix::net::UnixStream into its asynchronous equivalent.

Converts a CuckooFilter into a simplified version which can be serialized and stored for later use.

Converts a simplified representation of a filter used for export to a fully functioning version.

Contents
  • values - A serialized version of the CuckooFilter’s memory, where the fingerprints in each bucket are chained one after another, then in turn all buckets are chained together.
  • length - The number of valid fingerprints inside the CuckooFilter. This value is used as a time saving method, otherwise all fingerprints would need to be checked for equivalence against the null pattern.

Promote a X25519 secret key into a keypair.

Promote a X25519 secret key into a keypair.

Load a secret key from a byte array.

Given an x25519 EphemeralSecret key, compute its corresponding PublicKey.

Given a byte array, construct a x25519 PublicKey.

Given an x25519 StaticSecret key, compute its corresponding PublicKey.

Implemented for drop-in replacement support for colored

You can turn a Colour into a Style with the foreground colour set with the From trait.

use ansi_term::{Style, Colour};
let green_foreground = Style::default().fg(Colour::Green);
assert_eq!(green_foreground, Colour::Green.normal());
assert_eq!(green_foreground, Colour::Green.into());
assert_eq!(green_foreground, Style::from(Colour::Green));

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

Make an object from a byte array.

A Response can be piped as the Body of another request.

Transaction event queries are semantically a subset of general queries

Convert our custom event into the necessary tendermint proto type

Implementors

Intended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.

String converstion.

Convert attributes to Tendermint ABCI tags

Note

The parsing of Keys and Values never fails, because the FromStr instance of tendermint::abci::tag::{Key, Value} is infallible, even if it is not represented in the error type. Once tendermint-rs improves the API of the Key and Value types, we will be able to remove the .parse().unwrap() calls.

Convert attributes to Tendermint ABCI tags

Note

The parsing of Keys and Values never fails, because the FromStr instance of tendermint::abci::tag::{Key, Value} is infallible, even if it is not represented in the error type. Once tendermint-rs improves the API of the Key and Value types, we will be able to remove the .parse().unwrap() calls.

Convert attributes to Tendermint ABCI tags

Note

The parsing of Keys and Values never fails, because the FromStr instance of tendermint::abci::tag::{Key, Value} is infallible, even if it is not represented in the error type. Once tendermint-rs improves the API of the Key and Value types, we will be able to remove the .parse().unwrap() calls.

Converts from the domain type (which is represented as a vector of ics23::ProofSpec to the corresponding proto type (vector of ibc_proto::ProofSpec). TODO: fix with https://github.com/informalsystems/ibc-rs/issues/853

Stability note: This impl does not yet exist, but we are “reserving space” to add it in the future. See rust-lang/rust#64715 for details.